package cn.cdqf.coupon.dispatch.controller;

import cn.cdqf.coupon.dispatch.service.DispatchService;
import cn.cdqf.globle.common.ResultResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api("优惠券派发接口")
public class DispatchController {
    @Autowired
    private DispatchService dispatchService;
    /**
     *
     * 付款领取优惠券
     * 评价
     * 分享
     * 扫码领取
     * @param merchantId
     * @param userId
     * @param level
     * @return
     */
    @PutMapping("dispatch/{merchantId}/{userId}/{level}")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "商家id",type = "path",dataType = "string",required = true,name = "merchantId")
    })
    @ApiOperation("三个参数派发接口")
    public ResultResponse<String> dispatch(
            @PathVariable("merchantId") String merchantId,
            @PathVariable("userId") String userId,
            @PathVariable("level") Integer level){
        return dispatchService.dispatchByUserIdAndLevelAndMerchantId(merchantId,userId,level);
    }
}
